<% layout('/layout/default.html', {title: '历史流程', libs: ['dataGrid','icheck']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-cubes"></i> 历史流程
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询" ><i class="fa fa-filter"></i> 查询</a>
				<a href="javascript:" id="export" class="btn btn-default"><i class="glyphicon glyphicon-export"></i> 导出</a>
			</div>
		</div>
		<div class="box-body">
			<form id="searchForm" action="${ctx}/act/process/historyProcList" method="post" class="form-inline hide" >

				<div class="form-group">
					<label class="control-label">流程分类：</label>
					<div class="control-inline">
						<#form:select path="category" name="label" data="getDictList:act_category" class="form-control required " />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">发起人：</label>
					<div class="control-inline">
						<#form:select id="userid" path="startBy" name="name" value="loginName" data="${userList}" class="form-control " />
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">发布日期：</label>
					<input name="beginDate" placeholder="开始日期" maxlength="20" class="form-control width-120" readonly="readonly"
						   value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});" />
				</div>
				<div class="form-group">
					<label class="control-label">-</label>
					<div class="control-inline">
						<input name="endDate" placeholder="结束日期" maxlength="20" class="form-control width-120" readonly="readonly"
							   value="" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});" />
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button id="reset" type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</form>			
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script type="text/javascript">
	$('#export').click(function(){

		$('#searchForm').attr("action","${ctx}/act/process/exportHisProcList");
		document.getElementById('searchForm').submit();

		$('#searchForm').attr("action","${ctx}/act/process/historyProcList");
	});
</script>


<script>
	$.fn.select2.defaults.set('width', '200px');
	$('#reset').click(function(){
		$('#category').val(null).trigger("change");
		$('#userid').val(null).trigger("change");
	});
//初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
        {header:'流程名称', name:'name', index:'', width:80, align:"center" },
		{header:'流程发起人', name:'startUser.name', index:'', width:80, align:"center" },
        {header:'发起时间', name:'startTime', index:'startTime', width:120, align:"center", formatter:"date", formatoptions:{srcformat: 'Y-m-d H:i:s',newformat: 'Y-m-d H:i:s'} },
		{header:'操作', name:'actions', width:30, sortable:false, title:false, align:"center",formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('act:process:edit')){ %>
                actions.push('<a href="/act/flowForm/common?taskDefKey='+row.taskDefinitionKey+'&procInsId='+row.processInstanceId+'&procDefId='+row.processDefinitionId+'&status='+row.status+' " class="btnList" title="详情查看" >查看详情&nbsp;</a>')
			<% } %>
			
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});

</script>

<script type="text/javascript">

</script>